The concept of orthogonality, as represented in the Discrete Cosine Transform, is crucial
to performing image compression. Images consist of pixels, each represented by a number
(or three numbers, for color images). The convenient way that methods like the DCT
can carry out least squares approximation makes it easy to reduce the number of bits
needed to represent the pixel values, while degrading the picture only slightly, and perhaps
imperceptibly to human viewers.
In this problem we were tasked with extracting an 8 \(\times\) 8 pixel block from the given image, applying the 2D-DCT, using linear quantization with p = 1, 2, and 4, reconstructing the block using the inverse 2D-DCT, and comparing with the original. We then carried out the aforementioned procedure for all 8 \(\times\) 8 blocks, and reconstituted the image in each case. The linear quantization matrix Q is given by \[ Q = p \begin{bmatrix} 8 & 16 & 24 & 32 & 40 & 48 & 56 & 64 \\ 16 & 24 & 32 & 40 & 48 & 56 & 64 & 72 \\ 24 & 32 & 40 & 48 & 56 & 64 & 72 & 80 \\ 32 & 40 & 48 & 56 & 64 & 72 & 80 & 88 \\ 40 & 48 & 56 & 64 & 72 & 80 & 88 & 96 \\ 48 & 56 & 64 & 72 & 80 & 88 & 96 & 104 \\ 56 & 64 & 72 & 80 & 88 & 96 & 104 & 112 \\ 64 & 72 & 80 & 88 & 96 & 104 & 112 & 120 \\ \end{bmatrix}.\] The code used in this problem is Block Function, Main Routine.
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
We proceed as before, but this time quantizing by the JPEG-suggested matrix with p = 1, 2, and 4. The linear quantization matrix Q in this case is given by \[ Q_Y = p \begin{bmatrix} 16 & 11 & 10 & 16 & 24 & 40 & 51 & 61 \\ 12 & 12 & 14 & 19 & 26 & 58 & 60 & 55 \\ 14 & 13 & 16 & 24 & 40 & 57 & 69 & 56 \\ 14 & 17 & 22 & 29 & 51 & 87 & 80 & 62 \\ 18 & 22 & 37 & 56 & 68 & 109 & 103 & 77 \\ 24 & 35 & 55 & 64 & 81 & 104 & 113 & 92 \\ 49 & 64 & 78 & 87 & 103 & 121 & 120 & 101 \\ 72 & 92 & 95 & 98 & 112 & 100 & 103 & 99 \\ \end{bmatrix}.\] The code used in this problem is Block Function, Block Function 1, Main Routine.
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
In this problem, we carry out the steps of from before for the colors R, G, and B separately, use linear quantization, and recombine as a color image. The code for this problem is Block Function 2, Main Routine 2.
![]() |
![]() |
![]() |
![]() |
Finally, we transform the RGB values to luminance/color difference coordinates. Carry out the steps of Computer Problem 3 for Y , U, and V separately by using JPEG quantization, and recombine as a color image. The code for this problem is Block Function 2, Block Function 3, and Main Routine 3.
![]() |
![]() |
![]() |
![]() |
With the relatively small loss parameters above it is difficult to notice degradation in the quality of the image, so for fun we ramp up the p value to see some serious image degradation!
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |